/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.clientapi.provider;

import com.jili.ubert.clientapi.until.AnswerHandler;
import com.jili.ubert.dao.db.AlterOrder;
import com.jili.ubert.code.client2server.BasketCancelOrders;
import com.jili.ubert.code.client2server.BasketOrders;
import com.jili.ubert.code.client2server.RequestPageData;
import com.jili.ubert.dao.db.CancelOrder;
import com.jili.ubert.dao.db.NewOrder;
import com.jili.ubert.code.server2client.MsgResult;
import com.jili.ubert.code.server2client.MsgResultList;
import com.panemu.tiwulfx.common.TableData;
import com.jili.ubert.dao.db.AccountInfo;
import com.jili.ubert.dao.db.FundState;
import com.jili.ubert.dao.db.PosDetail;
import com.jili.ubert.dao.db.OrderExecuteProgress;
import com.jili.ubert.dao.db.TradeReportDetail;
import java.io.IOException;
import java.util.List;

/**
 *
 * @author ChengJili
 */
public interface TradeProvider {
    /*
     登陆登出
     */

//    public MsgResult Connect(String host, int port, boolean isSSL, boolean isZlib);
//    public MsgResult Login(Login login);
//    public MsgResult UserLogin(Login login);
//    public MsgWord getVerlidCode();
//    public MsgResult Logout();
    /*
     交易
     */
    public int CheckOrder(NewOrder order, AnswerHandler<MsgResult> handler) throws IOException;

    public int CheckOrder(BasketOrders orders, AnswerHandler<MsgResult> handler) throws IOException;

    public int CheckBasketOrder(BasketOrders orders, AnswerHandler<MsgResult> handler) throws IOException;

    public int CheckOrder(AlterOrder alterOrder, AnswerHandler<MsgResult> handler) throws IOException;

    public int CheckOrder(CancelOrder cancelOrder, AnswerHandler<MsgResult> handler) throws IOException;

    public int Send(NewOrder order, AnswerHandler<MsgResult> handler) throws IOException;

    public int Send(BasketOrders basketOrders, AnswerHandler<MsgResultList> handler) throws IOException;

    public int Send(CancelOrder cancelOrder, AnswerHandler<MsgResult> handler) throws IOException;

    public int Send(BasketCancelOrders bCancelorders, AnswerHandler<MsgResultList> handler) throws IOException;

    public int Send(AlterOrder alterOrder, AnswerHandler<MsgResult> handler) throws IOException;

    public int InnerExeSend(NewOrder order, AnswerHandler<MsgResult> handler) throws IOException;

    public int InnerExeSend(CancelOrder cancelOrder, AnswerHandler<MsgResult> handler) throws IOException;

    public int InnerExeSend(AlterOrder alterOrder, AnswerHandler<MsgResult> handler) throws IOException;

    /*
     出金入金
     */
    //1.银证转账
    public int Bank2Account(String accountCode, double amount, String remark, AnswerHandler<MsgResult> handler) throws IOException;

    //2证银转账
    public int Account2Bank(String accountCode, double amount, String remark, AnswerHandler<MsgResult> handler) throws IOException;

    //3.蓝补
    public int AddDelta(String accountCode, double amount, String remark, AnswerHandler<MsgResult> handler) throws IOException;

    //4.红补
    public int CutDelta(String accountCode, double amount, String remark, AnswerHandler<MsgResult> handler) throws IOException;
    /*
     查询
     */

    //1.可用账户列表;账户信息
    public int QueryAccountList(AnswerHandler<TableData<AccountInfo>> handler) throws IOException;

    public int QueryAccountList(RequestPageData rpd, AnswerHandler<TableData<AccountInfo>> handler) throws IOException;

    //2.资金信息
    public int QueryFundStatus(AnswerHandler<TableData<FundState>> handler) throws IOException;

    public int QueryFundStatus(String accountCode, AnswerHandler<TableData<FundState>> handler) throws IOException;

    public int QueryFundStatus(RequestPageData rpd, AnswerHandler<TableData<FundState>> handler) throws IOException;

    public int RegistFundFlush(String accountCode, AnswerHandler<FundState> handler) throws IOException;

    public int RegistFundFlush(AnswerHandler<FundState> handler) throws IOException;

    public int RemoveFundFlushListener(String accountCode, AnswerHandler<FundState> handler) throws IOException;

    public int RemoveFundFlushListener(AnswerHandler<FundState> handler) throws IOException;

    //3.持仓信息
    public int QueryPosDetails(String accountCode, AnswerHandler<TableData<PosDetail>> handler) throws IOException;

    public int QueryPosDetails(RequestPageData rpd, AnswerHandler<TableData<PosDetail>> handler) throws IOException;

    public int RegistPosFlush(String accountCode, AnswerHandler<PosDetail> handler) throws IOException;

    public int RegistPosFlush(AnswerHandler<PosDetail> handler) throws IOException;

    public int RemovPosFlushListener(String accountCode, AnswerHandler<PosDetail> handler) throws IOException;

    public int RemovPosFlushListener(AnswerHandler<PosDetail> handler) throws IOException;

    //4.订单执行进度
    public int getOrderExeLastStatus(int orderID, AnswerHandler<OrderExecuteProgress> handler) throws IOException;
    
    public int QueryOrderExecuteProgress(String accountCode, AnswerHandler<TableData<OrderExecuteProgress>> handler) throws IOException;

    public int QueryOrderExecuteProgress(RequestPageData rpd, AnswerHandler<TableData<OrderExecuteProgress>> handler) throws IOException;

    public void RegistOrderExecuteProgress(String accountCode, AnswerHandler<OrderExecuteProgress> handler) throws IOException;

    public void RegistOrderExecuteProgress(AnswerHandler<OrderExecuteProgress> handler) throws IOException;

    public int RemoveOrderExecuteProgressListener(String accountCode, AnswerHandler<OrderExecuteProgress> handler) throws IOException;

    public int RemoveOrderExecuteProgressListener(AnswerHandler<OrderExecuteProgress> handler) throws IOException;

    //6.订单指令
    //6.1 下单委托
    public void QueryNewOrders(String accountCode, AnswerHandler<TableData<NewOrder>> handler) throws IOException;

    public void QueryNewOrders(RequestPageData rpd, AnswerHandler<TableData<NewOrder>> handler) throws IOException;

    public void RegistNewOrders(String accountCode, AnswerHandler<NewOrder> handler) throws IOException;

    public void RegistNewOrders(AnswerHandler<NewOrder> handler) throws IOException;

    public int RemoveNewOrdersListener(String accountCode, AnswerHandler<NewOrder> handler) throws IOException;

    public int RemoveNewOrdersListener(AnswerHandler<NewOrder> handler) throws IOException;

    //6.2 撤单

    public void QueryCancelOrders(String accountCode, AnswerHandler<TableData<CancelOrder>> handler) throws IOException;

    public void QueryCancelOrders(RequestPageData rpd, AnswerHandler<TableData<CancelOrder>> handler) throws IOException;

    public void RegistCancelOrders(String accountCode, AnswerHandler<CancelOrder> handler) throws IOException;

    public void RegistCancelOrders(AnswerHandler<CancelOrder> handler) throws IOException;

    public int RemoveCancelOrdersListener(String accountCode, AnswerHandler<CancelOrder> handler) throws IOException;

    public int RemoveCancelOrdersListener(AnswerHandler<CancelOrder> handler) throws IOException;

    //6.3 改单

    public void QueryAlterOrders(String accountCode, AnswerHandler<TableData<AlterOrder>> handler) throws IOException;

    public void QueryAlterOrders(RequestPageData rpd, AnswerHandler<TableData<AlterOrder>> handler) throws IOException;

    public void RegistAlterOrders(String accountCode, AnswerHandler<AlterOrder> handler) throws IOException;

    public void RegistAlterOrders(AnswerHandler<AlterOrder> handler) throws IOException;

    public int RemoveAlterOrdersListener(String accountCode, AnswerHandler<AlterOrder> handler) throws IOException;

    public int RemoveAlterOrdersListener(AnswerHandler<AlterOrder> handler) throws IOException;

    //7. 回报详情
    public void QueryOrderReports(int orderID, AnswerHandler<TableData<TradeReportDetail>> handler) throws IOException;
    public int getOrderReportDetail(int orderID, AnswerHandler<List<FundState>> handler) throws IOException;

    public void QueryOrderReports(RequestPageData rpd, AnswerHandler<TableData<TradeReportDetail>> handler) throws IOException;
    public int QueryOrderExecuteProgressList(RequestPageData rpd, AnswerHandler<TableData<OrderExecuteProgress>> handler) throws IOException;

}
